<?php

use think\facade\Route;

Route::group(function () {
    Route::group(function () {
        Route::any('test', 'Common/test');

        Route::post('login', 'Login/login');
        Route::get('getCaptcha', 'Common/getCaptcha');
    });

    Route::group(function () {
        Route::get('getPermCode$', 'Common/getPermCode');//新版本后台获取用户权限编码接口
        Route::get('getMenuList$', 'Common/getMenuList');//新版本后台获取用户菜单接口
        Route::get('getUserInfo$', 'Login/getUserInfo');

        //+-------------------------------
        //|公用选项相关
        //+-------------------------------
        Route::get('common/admin/menus/[:type]$', 'common/adminMenus');   //获取管理员操作菜单
        Route::get('common/admin/group$', 'common/adminGroup'); //获取所有管理员用户组

        //+----------------------
        //|管理员相关
        //+----------------------
        Route::get('admin/user/:page/:pageSize/[:search]$', 'Admin/retrieve');
        Route::post('admin/user$', 'Admin/create');
        Route::put('admin/user/:id$', 'Admin/update');
        Route::put('changePassword/:id$', 'Admin/changePassword');
        Route::delete('admin/user/:id$', 'Admin/delete');

        //+----------------------
        //|管理员权限组
        //+----------------------
        Route::get('admin/group/:page/:pageSize/[:search]$', 'AdminGroup/retrieve');
        Route::post('admin/group$', 'AdminGroup/create');
        Route::put('admin/group/:id$', 'AdminGroup/update');
        Route::delete('admin/group/:id$', 'AdminGroup/delete');

        //+----------------------
        //|管理员菜单
        //+----------------------
        Route::get('admin/menus$', 'AdminMenus/retrieve');
        Route::post('admin/menus$', 'AdminMenus/create');
        Route::put('admin/menus/:id$', 'AdminMenus/update');
        Route::delete('admin/menus/:id$', 'AdminMenus/delete');
    });
});